package com.qf.controller;

import com.qf.feign.TestFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 千锋健哥
 */
@RestController
@RequestMapping("/hello")
//动态刷新从配置中心拉取的内容
@RefreshScope
public class HelloController {

    @Autowired
    private TestFeign testFeign;

    //尝试从nacos配置中心获取这个属性的值
    @Value("${version}")
    private String version;

    @GetMapping("/test")
    public String test() {
        String hello = testFeign.hello();
        System.out.println("==========" + version);
        return hello;
    }

    @GetMapping("/test1")
    public String test1() {
        return "test1";
    }
}
